package com.qianfeng.zhangwei.xytg.utils;

import android.graphics.Bitmap;

import com.nostra13.universalimageloader.core.DisplayImageOptions;
import com.nostra13.universalimageloader.core.assist.ImageScaleType;
import com.qianfeng.zhangwei.xytg.R;

/**
 * @说 明：
 * @项目名称：Sz1504
 * @包 名： com.qianfeng.zhangwei.day26.utils
 * @类 名： ImageLoaderHelper
 * @创 建人： zhangwei
 * @创建时间：2015-07-24 15:31
 * @版 本：v1.0
 * @修 改人：
 * @修改时间：
 * @修改备注：
 */
public class ImageLoaderHelper {
    private static ImageLoaderHelper helper;


    private ImageLoaderHelper() {
    }


    public static ImageLoaderHelper getInstance() {
        if (helper == null) {
            helper = new ImageLoaderHelper();
        }
        return helper;
    }


    public DisplayImageOptions getDisplayImageOptions(int resFailId, int resLoadingId) {
        DisplayImageOptions.Builder builder = new DisplayImageOptions.Builder();
        //启用内存缓存
        builder.cacheInMemory(true);
        builder.cacheOnDisk(true);
        builder.showImageOnLoading(resLoadingId);
        builder.showImageOnFail(resFailId);
        builder.bitmapConfig(Bitmap.Config.RGB_565);
        builder.imageScaleType(ImageScaleType.EXACTLY);
        return builder.build();
    }

    public DisplayImageOptions getDisplayCateGroyImageOptions() {
        DisplayImageOptions.Builder builder = new DisplayImageOptions.Builder();
        //启用内存缓存
        builder.cacheInMemory(true);
        builder.cacheOnDisk(true);
        builder.showImageOnLoading(R.mipmap.umeng_socialize_share_pic);
        builder.showImageOnFail(R.mipmap.umeng_socialize_share_pic);
        builder.bitmapConfig(Bitmap.Config.RGB_565);
        builder.imageScaleType(ImageScaleType.EXACTLY);
        return builder.build();
    }


}
